<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

//*************************麦志建的路由  start  ********************************** 

//登录页面
Route::get('/home/login', ['uses' => 'Admin\Login\loginControllers@index']);
Route::post('/home/dologin', ['uses' => 'Admin\Login\loginControllers@dologin']);
Route::any('/home/loginout', ['uses' => 'Admin\Login\loginControllers@loginout']);
//没有权限的都来这
Route::any('/stop', function(){
    return view('Admin/stop');
});


Route::group(['prefix' => 'Admin', 'middleware' => 'rbac.role:superadmin'], function() {
    //后台首页
    Route::get('/', 'Admin\Index\adminIndexController@index')->name('admin');
    //后台首页-首页内容路由
    Route::get('welcome', ['uses' => 'Admin\Index\adminIndexController@welcome']);
    //后台用户角色路由
    Route::get('role', ['middleware' => 'rbac.permission:role-list','uses' => 'Admin\AdminUsers\adminUsersController@role']);
    Route::get('roleadd', ['middleware' => 'rbac.permission:role-create','uses' => 'Admin\AdminUsers\adminUsersController@roleAdd']);
    Route::post('roledoadd', ['middleware' => 'rbac.permission:role-create','uses' => 'Admin\AdminUsers\adminUsersController@roleDoAdd']);
    Route::any('roleedit', ['middleware' => 'rbac.permission:role-edit','uses' => 'Admin\AdminUsers\adminUsersController@roleedit']);
    Route::any('roledoedit', ['middleware' => 'rbac.permission:role-edit','uses' => 'Admin\AdminUsers\adminUsersController@roleDoEdit']);
    Route::any('roledel', ['middleware' => 'rbac.permission2:role-delete','uses' => 'Admin\AdminUsers\adminUsersController@roleDel']);
    Route::any('role/find', ['middleware' => 'rbac.permission2:role-delete','uses' => 'Admin\AdminUsers\adminUsersController@rolefind']);
    Route::get('roleshow', ['middleware' => 'rbac.permission2:role-list','uses' => 'Admin\AdminUsers\adminUsersController@roleshow']);
    //后台用户角色权限路由
    Route::get('permission', ['middleware' => 'rbac.permission:permission-list','uses' => 'Admin\AdminUsers\adminUsersController@permission']);
    Route::get('permissionadd', ['middleware' => 'rbac.permission:permission-create','uses' => 'Admin\AdminUsers\adminUsersController@permissionAdd']);
    Route::post('permissiondoadd', ['middleware' => 'rbac.permission:permission-create','uses' => 'Admin\AdminUsers\adminUsersController@permissionDoAdd']);
    Route::any('permissionedit', ['middleware' => 'rbac.permission:permission-edit','uses' => 'Admin\AdminUsers\adminUsersController@permissionEdit']);
    Route::post('permissiondoedit', ['middleware' => 'rbac.permission:permission-edit','uses' => 'Admin\AdminUsers\adminUsersController@permissionDoEdit']);
    Route::get('permissiondel', ['middleware' => 'rbac.permission2:permission-delete','uses' => 'Admin\AdminUsers\adminUsersController@permissionDel']);
    Route::get('permission/find', ['middleware' => 'rbac.permission:permission-list','uses' => 'Admin\AdminUsers\adminUsersController@findpermission']);
    // ->middleware(['rbac.role:superadmin']);
    //后台用户路由
    Route::get('lists', ['middleware' => 'rbac.permission:user-list','uses' => 'Admin\AdminUsers\adminUsersController@lists']);
    Route::get('admin-add', ['middleware' => 'rbac.permission:user-create','uses' => 'Admin\AdminUsers\adminUsersController@admin_add']);
    Route::post('admin-add/do-add', ['middleware' => 'rbac.permission:user-create','uses' => 'Admin\AdminUsers\adminUsersController@doAdd']);
    Route::get('admin-add/do-del', ['middleware' => 'rbac.permission2:user-delete','uses' => 'Admin\AdminUsers\Api\AdminUsersApi@del']);
    Route::any('admin-add/do-stop', ['middleware' => 'rbac.permission:user-edit','uses' => 'Admin\AdminUsers\Api\AdminUsersApi@stop']);
    Route::any('admin-add/do-start', ['middleware' => 'rbac.permission:user-edit','uses' => 'Admin\AdminUsers\Api\AdminUsersApi@start']);
    Route::any('admin-edit', ['middleware' => 'rbac.permission:user-edit','uses' => 'Admin\AdminUsers\adminUsersController@edit']);
    Route::any('admin-edit/do-edit', ['middleware' => 'rbac.permission:user-edit','uses' => 'Admin\AdminUsers\adminUsersController@doEdit']);
    Route::get('lists/find', ['middleware' => 'rbac.permission:user-list','uses' => 'Admin\AdminUsers\adminUsersController@finduser']);
    //前端用户路由
    Route::get('member-list', ['middleware' => 'rbac.permission:member-list','uses' => 'Admin\HomeUsers\homeUsersController@list']);
    Route::get('member-add', ['middleware' => 'rbac.permission:member-create','uses' => 'Admin\HomeUsers\homeUsersController@add']);
    Route::post('member-doadd', ['middleware' => 'rbac.permission:member-create','uses' => 'Admin\HomeUsers\homeUsersController@doadd']);
    Route::get('member-chagepassword', ['middleware' => 'rbac.permission:member-edit','uses' => 'Admin\HomeUsers\homeUsersController@chagepassword']);
    Route::post('member-dochagepassword', ['middleware' => 'rbac.permission:member-edit','uses' => 'Admin\HomeUsers\Api\homeUsersApi@doChagePassword']);
    Route::get('member-edit', ['middleware' => 'rbac.permission:member-edit','uses' => 'Admin\HomeUsers\homeUsersController@edit']);
    Route::post('member-doedit', ['middleware' => 'rbac.permission:member-edit','uses' => 'Admin\HomeUsers\Api\homeUsersApi@doedit']);
    Route::get('member-show', ['middleware' => 'rbac.permission:member-show','uses' => 'Admin\HomeUsers\homeUsersController@show']);
    Route::get('member-start', ['middleware' => 'rbac.permission:member-edit','uses' => 'Admin\HomeUsers\Api\homeUsersApi@start']);
    Route::get('member-stop', ['middleware' => 'rbac.permission:member-edit','uses' => 'Admin\HomeUsers\Api\homeUsersApi@stop']);
    Route::get('member-find', ['middleware' => 'rbac.permission:member-list','uses' => 'Admin\HomeUsers\homeUsersController@find']);

    //网站信息
    Route::get('system-base', ['middleware' => 'rbac.permission:system-list','uses' => 'Admin\System\systemController@base']);
    Route::post('system-base/save', ['middleware' => 'rbac.permission:system-edit','uses' => 'Admin\System\systemController@save']);
    //友情链接
    Route::get('system-friendlink', ['middleware' => 'rbac.permission:friendlink-list','uses' => 'Admin\System\friendLinkController@list']);
    Route::post('system-friendlink-add',['middleware' => 'rbac.permission:friendlink-create','uses' => 'Admin\System\friendLinkController@add']);
    Route::get('system-friendlink-del',['middleware' => 'rbac.permission:friendlink-delete','uses' => 'Admin\System\friendLinkController@del']);
    Route::get('system-friendlink-edit',['middleware' => 'rbac.permission:friendlink-edit','uses' => 'Admin\System\friendLinkController@edit']);


    //品牌
    Route::get('product-brand', 'Admin\Brand\brandController@list');
    Route::get('product-brand-del', 'Admin\Brand\brandController@del');
    Route::post('product-brand-add', 'Admin\Brand\brandController@add');
    Route::get('product-brand-edit', 'Admin\Brand\brandController@edit');
    Route::post('product-brand-doedit', 'Admin\Brand\brandController@doedit');


//*************************麦志建的路由  end  ********************************** 


//*************************陈新彬后台路由 start ********************************* 
//后台分类资源模块
Route::resource('product-category', 'Admin\Category\CategoryController');
//后台根分类执行添加的路由
Route::post('product-category/store', 'Admin\Category\CategoryController@store');
//后台子分类添加页面的路由
Route::get('product-category/childAdd/{id}', 'Admin\Category\CategoryController@childAdd');
//后台子分类执行添加的路由
Route::post('product-category/childInsert', 'Admin\Category\CategoryController@childInsert');//后台子分类添加


//后台商品资源模块
Route::resource('goods', 'Admin\Goods\GoodsController');
//后台执行商品添加的路由
Route::post('goods/store', 'Admin\Goods\GoodsController@store');
//后台产品不同颜色尺寸属性的添加页面的路由
Route::get('goods/addGoodAttributes/{id}', 'Admin\Goods\GoodsController@addGoodAttributes');
//后台执行添加产品不同颜色尺寸属性的路由
Route::post('goods/insertAttributesToGoodsPrice', 'Admin\Goods\GoodsController@insertAttributesToGoodsPrice');
//后台在产品列表页面执行产品上架的路由
Route::get('good/goods_up', 'Admin\Goods\Api\GoodsApi@up');
//后台在产品列表页面执行产品下架的路由
Route::get('good/goods_down', 'Admin\Goods\Api\GoodsApi@down');
//后台产品列表页搜索的路由
Route::get('good/showgood', 'Admin\Goods\Api\GoodsApi@showgood');
//后台产品列表页点击"此款产品的图片"出现的该产品所有图片的页面的路由 显示goods_show的图片
Route::get('goods/showPhoto/{id}', 'Admin\Goods\GoodsController@showPhoto');
//后台产品列表页点击"点击添加图片"出现此产品图片添加页面的路由  添加goods_show的图片
Route::get('goods/addGoodPhoto/{id}', 'Admin\Goods\GoodsController@addGoodPhoto');
//后台执行添加产品图片的路由                 执行添加goods_show的图片
Route::post('goods/uploadGoodPhoto', 'Admin\Goods\GoodsController@uploadGoodPhoto');
//后台图片列表页该产品图片的编辑页面的路由   编辑goods_show的图片
Route::get('goodsShow/showedit/{id}', 'Admin\Goods\GoodsShowController@showedit');
//后台图片列表页执行修改产品图片的路由       修改goods_show的图片
Route::post('goodsShow/showupdate', 'Admin\Goods\GoodsShowController@showupdate');
//后台图片列表页删除产品图片                 删除goods_show的图片
Route::get('goodsShow/showdel/{id}', 'Admin\Goods\GoodsShowController@showdel');

//麦志建查你一条
Route::get('goods/turnshowpic/{id}', 'Admin\Goods\GoodsController@turnShowPic')->where('id', '[0-9]+');;//产品轮播图
Route::post('goods/turnshowpicedit', 'Admin\Goods\GoodsController@turnShowPicEdit');//产品轮播图
Route::get('goods/turnshowpic/turnon', 'Admin\Goods\GoodsController@turnON');//产品轮播图
Route::get('goods/turnshowpic/turnoff', 'Admin\Goods\GoodsController@turnOFF');//产品轮播图



//吴伯恒的路由
//后台积分管理的路由
//显示编辑页面
Route::get('score', 'Admin\Score\ScoreController@scoreIndex');
//执行修改积分
Route::post('scoreupdate', 'Admin\Score\Api\ScoreApi@update');

//后台商品管理-商品详情页的路由
//执行商品的某个尺寸颜色的下架的路由
Route::get('goodsprice/pull', 'Admin\Goods\Api\GoodsApi@goodsPricePull');
//执行商品的某个尺寸颜色的上架的路由
Route::get('goodsprice/push', 'Admin\Goods\Api\GoodsApi@goodsPricePush');
//执行商品的某个尺寸颜色的缺货的路由
Route::get('goodsprice/shortage', 'Admin\Goods\Api\GoodsApi@goodsPriceShortage');

//商品详情页的Resource路由
Route::resource('goodsprice', 'Admin\Goods\GoodsPriceResourceController');

//商品促销模块的路由
//商品促销模块显示列表页面
Route::get('salepromotion/list', 'Admin\Goods\SalePromotionController@list');
//商品促销模块显示添加页面
Route::get('salepromotion/add', 'Admin\Goods\SalePromotionController@add');

//商品促销模块执行添加
Route::post('salepromotion/doadd', 'Admin\Goods\SalePromotionController@doAdd');
//商品促销模块显示修改页面
Route::get('salepromotion/edit', 'Admin\Goods\SalePromotionController@edit');
//商品促销模块执行修改
Route::post('salepromotion/doupdate', 'Admin\Goods\SalePromotionController@doUpdate');
//商品促销模块设置促销为过期
Route::get('salepromotion/setnotactive/{id}', 'Admin\Goods\SalePromotionController@setNotActive');
//商品促销模块设置促销为过期
Route::get('salepromotion/setactive', 'Admin\Goods\SalePromotionController@setActive');



});

//*************************陈新彬后台路由 end ********************************* 



//**************  吴伯恒的路由  start  *****************

//用于测试API的路由
Route::get('/add', 'Home\Search\SearchController@add');
Route::get('/clean', 'Home\Search\SearchController@cleanIndex');
Route::get('/flush', 'Home\Search\SearchController@flushIndex');
Route::get('/hot', 'Home\Search\SearchController@getHotQuery');
Route::get('/update', 'Home\Search\SearchController@update');


Route::get('/star/{gid}/{pid}', 'Home\Index\Api\IndexApi@loadHomePromotion');
Route::get('/star/{sortnum}', 'Home\Index\Api\IndexLazyLoad@lazyLoad');
Route::get('/star', 'Admin\Goods\Api\GoodsApi@goodsPricePull');

//首页路由
Route::get('/', 'Home\Index\IndexController@index')->name('index');

//首页'热卖促销栏目'的懒加载
Route::get('/indexhotlazyload', 'Home\Index\Api\IndexLazyLoad@lazyLoad');

//搜索商品名,跳链到商品列表页
Route::get('/search/{sub}', 'Home\Search\SearchController@doSearch');

//通过点击商品分类,跳链到商品列表页
Route::get('goodslist', 'Home\Index\IndexController@listByCategory');


//**************  吴伯恒的路由  end  *****************



//**************  陈新彬的路由  start  *****************

Route::get('/goods-detail/{gid}','Home\Goods\GoodsController@detail');


//**************  陈新彬的路由  end  *****************


//**************  刘冠生的路由  start  *****************
//购物车路由
Route::any('/cart', 'Home\Cart\CartController@index')->name('cartShow');
Route::any('/addcart/{gid}/{pid}/{itemNum}', 'Home\Cart\CartController@addItem')->name('cartAdd');
Route::any('/delcart/{pid}', 'Home\Cart\CartController@delItem')->name('cartDel');
Route::any('/flushcart', 'Home\Cart\CartController@flushCart');

//订单路由
Route::any('/confirmorder','Home\Orders\OrdersController@confirmOrders');
Route::any('/pay','Home\Orders\OrdersController@pay');
Route::any('/dopay/{oid}','Home\Orders\OrdersController@dopay');
Route::any('/dobuy/{gid}/{pid}/{num}','Home\Orders\OrdersController@dobuy');
Route::any('/addr','Home\Orders\OrdersController@addAddress');

//后台订单展示
Route::get('/admin/orders/', ['uses' => 'Admin\Orders\AdminOrdersController@index'])->name('adminorders');
Route::any('/admin/doeditOrders', ['uses' => 'Admin\Orders\AdminOrdersController@doEditOrders']);
Route::get('/admin/orders/{oid}', ['uses' => 'Admin\Orders\AdminOrdersController@showDetail']);
Route::get('/admin/orders/{oid}/edit', ['uses' => 'Admin\Orders\AdminOrdersController@editOrders']);

//测试控制器路由
Route::any('/test','test@index');

//**************  刘冠生的路由  end  *****************



//**************  谢俊杰的路由  start  *****************

/**
 * jason所属路由器
 * 显示注册和登录
 */
//登录页面路由
Route::get('/login','Home\User\UserController@loginView')->name('login');

//注册页面路由
Route::get('/register','Home\User\UserController@registerView');

//忘记密码页面路由
Route::get('/forgotpwd', 'Home\User\UserController@forgotpwdView');

//重置密码页面
Route::get('/doResetPwd/{Modifycondition}', 'Home\User\UserController@resetpwdView');

//验证码控制器路由
Route::get('/makecode', 'Common\CommonCodeApi@buildCode');

//短信验证码控制器路由
Route::post('/send', 'Common\CommonphoneCodeApi@sendPhoneMsg');

//邮箱验证码控制器路由
Route::post('/sendemail', 'Common\CommonEmailApi@sendEmailMsg');

//检查用户是否存在注册控制器路由
Route::post('/doregister','Home\User\Api\UserApi@existsRegister');

//执行注册控制器路由
Route::post('/goregister','Home\User\Api\UserApi@handlerRegister');

//登录控制器路由
Route::post('/dologin', 'Home\User\Api\UserApi@handlerLogin');

//用手机重置密码控制器路由
Route::post('/phoneRePwd', 'Home\User\Api\UserApi@phoneRePwd');

//用邮箱重置密码控制器路由
Route::post('/emailRePwd', 'Home\User\Api\UserApi@emailRePwd');

//执行重置密码控制器路由
Route::post('/doresetpwd', 'Home\User\Api\UserApi@forResetPwd');

//退出登录路由
Route::get('/removeuserinfo', 'Home\User\Api\UserApi@removeUserInfo');

//用户中心路由
Route::middleware(['checkuser'])->group(function () {

    //用户中心首页
	Route::get('/usercenter', 'Home\User\UserController@usercenterView');
	
    //我的所有订单
	Route::get('/myorder', 'Home\User\UserController@myorderView')->name('order');

    //待付款订单
    Route::get('/odState0', 'Home\User\UserController@myorder0View');

    //待发货订单
    Route::get('/odState1', 'Home\User\UserController@myorder1View');

    //待收货订单
    Route::get('/odState2', 'Home\User\UserController@myorder2View');

    //显示账号信息页面
	Route::get('/account', 'Home\User\UserController@myaccountView');

    //显示地址页面
	Route::get('/address', 'Home\User\UserController@myaddressView');

    //显示我的收藏
    Route::get('/address', 'Home\User\UserController@myaddressView');

    //显示订单详情页
    Route::get('/orders_detail/{oid}', 'Home\User\UserController@myorders_detailView');

    //添加地址页面
    Route::get('/addAd', 'Home\User\UserController@addAdView');

    //修改地址页面
    Route::get('/editAd/{id}', 'Home\User\UserController@editAdView');

    //搜索订单
    Route::get('/search', 'Home\User\Api\UserCenterApi@searchOrders');

    //删除地址
    Route::get('/deleteAd/{id}', 'Home\User\Api\UserCenterApi@dodeleteAd');

    //修改状态
    Route::post('/editOdState', 'Home\User\Api\UserCenterApi@editOdState');

    //修改用户信息
    Route::post('/editUc', 'Home\User\Api\UserCenterApi@editUc');
    
    //修改地址
    Route::post('/doeditAd', 'Home\User\Api\UserCenterApi@doeditAd');

    //增加地址
    Route::post('/doAddAddress', 'Home\User\Api\UserCenterApi@doAddAddress');

    //显示我的收藏
    Route::get('/favourites', 'Home\User\UserController@myfavouritesView');
    //添加收藏
    Route::get('/like/{gid}', 'Home\User\Api\UserCenterApi@dolike');

    //删除收藏
    Route::get('/rmFav/{gid}', 'Home\User\Api\UserCenterApi@doRmlick');
    
});

//**************  谢俊杰的路由  end  *****************



